/*
 * @Author: Luo jiaxing 
 * @Date: 2017-05-22 17:30:01 
 * @Last Modified by: cgd
 * @Last Modified time: 2017-11-06 14:25:29
 */
Ext.define('Admin.view.solutionManage.manages.Xun', {
    extend: 'Ext.container.Container',
    xtype: 'xunSolutionManage',
    requires: ['Admin.view.solutionManage.SolutionManageController'],
    controller: 'solutionManageController',
    height: 200,
    margin: 10,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    items: [{
        height: 50,
        xtype: 'toolbar',
        cls: 'shadow',
        margin: '0 0 10 0',
        border: 1,
        style: {
            borderColor: '#ccc',
            borderStyle: 'solid'
        },
        items: [{
            reference: 'start_date',
            xtype: "datetimefield",
            fieldLabel: "时间",
            labelWidth: 30,
            width: 200,
            listeners: {
                change: function() {
                    var edDt = this.nextSibling().nextSibling();
                    edDt.setMinValue(this.value)
                }
            }
        }, '--', {
            reference: 'end_date',
            xtype: "datetimefield",
            width: 200
        }, {
            xtype: "textfield",
            maxWidth: 200,
            labelWidth: 35,
            padding: '0 0 0 10',
            fieldLabel: "类型",
            // labelWidth: 85,
            value: '旬调度',
            readOnly: true
        }, {
            reference: 'user',
            xtype: "combo",
            maxWidth: 220,
            width: '15%',
            labelWidth: 50,
            padding: '0 0 0 10',
            fieldLabel: "制作人",
            // labelWidth: 85,
            valueField: 'value', //值字段  
            displayField: 'text', //显示字段  
            // value: '1', //默认值,要设置为提交给后台的值，不要设置为显示文本  
            emptyText: '请选择', //提示信息 
            readOnly: false, //只读，为true时不能编辑不能点击  
            store: {
                fields: ['value', 'text'],
                data: [
                    ['1', '用户A']
                ]
            }
        }, {
            xtype: 'button',
            text: '查询',
            handler: 'filterData'
        }, {
            xtype: 'button',
            text: '新建方案',
            handler: 'toNewXunSolution'
        }]
    }, {
        flex: 1,
        reference: 'solutionGrid',
        xtype: 'grid',
        style: 'border: 1px solid #ccc',
        autoScroll: true,
        loadMask: true,
        stripeRows: true,
        columnLines: true,
        // forceFit: true, //表格自适应
        columns: [{
            header: '方案编号',
            flex: 1,
            dataIndex: 'proCd',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '方案名称',
            flex: 1,
            dataIndex: 'proNm',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '制作人',
            flex: 1,
            dataIndex: 'producer',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '月径流预报',
            flex: 1,
            dataIndex: 'sta',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE',
            renderer: 'formatSta0'
        }, {
            header: '水量分配',
            flex: 1,
            dataIndex: 'sta',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE',
            renderer: 'formatSta3'
        }, {
            header: '水量调度',
            flex: 1,
            dataIndex: 'sta',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE',
            renderer: 'formatSta4'
        }, {
            header: '方案描述',
            flex: 1,
            dataIndex: 'nt',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '创建时间',
            flex: 1,
            dataIndex: 'crDt',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '方案起始时间',
            flex: 1,
            dataIndex: 'bgDt',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            header: '方案终止时间',
            flex: 1,
            dataIndex: 'edDt',
            editor: 'textfield',
            align: 'center',
            style: 'background: #EEEEEE'
        }, {
            xtype: 'actioncolumn',
            width: 150,
            text: '操作',
            align: 'center',
            style: 'background: #EEEEEE',
            items: [{
                iconCls: 'x-fa fa-info',
                tooltip: '查看',
                handler: 'xunSolutionView'
            }, {
                iconCls: 'x-fa fa-edit',
                tooltip: '编辑',
                handler: 'xunSolutionEdit'
            }, {
                iconCls: 'x-fa fa-times-circle',
                tooltip: '删除',
                handler: 'solutionDelete'
            }]
        }],
        listeners: {
            itemdblclick: 'viewSolution'
        },
        dockedItems: [
            {
                xtype: 'pagingtoolbar',
                dock: 'bottom',
                itemId: 'pagingToolbar',
                displayInfo: true,
                pageSize: 10,
                emptyMsg: '没有记录'
            }
        ],
        store: {
            fields: ['proCd', 'proNm', 'crDt', 'producer', 'sta', 'nt', 'bgDt', 'edDt'],
            proxy: {
                type: 'ajax',
                url: '/jsite-szy-dispatch/a/szy/dispatch/ddsRdP/listOfPage',
                extraParams: {
                    type: '3',
                    river: config.RIVER
                },
                reader: {
                    root: 'list',
                    totalProperty: 'count'
                }
            },
            autoLoad: true
        }
    }
        // {
        //     html: '<div style="width: 70%;height: 500px;margin: auto;margin-top: 30px;' +
        //     'background:url(\'resources/images/fh/qsdy.png\') no-repeat;background-size:100% 100%;"></div>'
        // }
    ]
});